package com.wcl.nullmusic.base;

import android.os.Bundle;
import android.os.RemoteException;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;


/**
 * Created by dllo on 16/1/4.
 */
public abstract class BaseActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayout());

        conService();
        initView();
        getVaule();
        initData();
        listener();
    }


    @Override
    protected void onResume() {
        super.onResume();

    }


    // 连接服务
    protected abstract void conService();

    /**
     * 加载布局
     *
     * @return
     */
    protected abstract int getLayout();

    /**
     * 跳转后值的接收
     */
    protected abstract void getVaule();

    /**
     * 初始化控件
     */
    protected abstract void initView();

    /**
     * 初始化数据
     */
    protected abstract void initData();

    /**
     * 控件的监听
     */
    protected abstract void listener();


    // 泛型T继承View 返回值为T
    public <T extends View> T findView(int id) {
        // 强转为T
        return (T) findViewById(id);
    }


    @Override
    protected void onDestroy() {
//BaseAppcation.removeActivity(this);
        super.onDestroy();
    }
}
